use util.isNullOrUndefined instead of typeof; #4