added more checks