minor refactor (improve null handling case)