added chech if one of the arguments ar NULL