Bugs Fixes

Fixes many bugs from minor to moderate.