[FIX] Couple of logic errors and syntax error