fix broken logic