add null check to fix failing jasmine tests