Fix: used function only returns 1 or undef