fixed length-- in freeMemoryLocation and fixed output