added a NotNull check for the worst case scenarios