added memory stabilization