Added nullable checks