Added some extra logic to account for possible null values

EV-185