Fixes

Some problems still exist with unboundlocalerror