fixed edge case of null reference