Fix order of access checking.