null check instead of instanceof