Bug fixes and new mapping for sub