Fix Bugs/Errors

Couple of logic errors