fixed hasFreeSpace bug