fixed issue with if statments short circuiting