fix null-checking