minor changes and bug fixes

minor changes and bug fixes