Added some extra checks.