Bug fixes for last commit