Bug fixes

Clean up the bug issuses