add if to check for null-pointer
code cleanup