added some checks.