Fixes to if and throw