fixed saving and collecting
various bugfixes
fixed line endings