avoid method call on undef