return null instead of method on non-object error