fixed a bug in turtle serializer
added an option to make flush synchronous