infinite loop when finding table free space