Fix dangerous behavoir (returning pointer from the stack)