Bug fixes

Some bugs on the bugs list have been fixed