Fixing possible bug cleaning memory stack