bug fixes

Bug fixes

Please review