bug fixes and small changes

 Please enter the commit message for your changes. Lines starting