fixed bug if recalling the function and already mallocd