memory error fix