fix for function call on null