added one more check and removed unnecessary error msg