Fixed bug in memarray