fixed conditional statement in magic