added some checks
wrong check-condition