Fixes a few bugs
Fixes some bugs