added nonnull check