Fixing undef return val error