Bug Fixes

A lot of fixes of bugs