Bug fixes

Minor bug fixes