Fix bug in method: trimFreeSpace