Fix bug in serialization, refactor collider