Fix association mapping

why are you changing the order in which these checks are performed ?