finally the bug is there, you cannot return ref to a local var