fix freelist bugs