Added some checks on variables.