added more checks.