Fix wrong contitional variables and conditions.