addded a security check