replaced abort with if