repaired bug with memory overflow