fixes conditional logic