bug fixes, clean up
xml writer, scene to text and environment editor

* bug fixes everywhere