added memory and fix initial ESP