fixed bug in memarray