sync_write implemented

  * sync_write tested
  * some bugfixes
  * some helper functions added
  * also added some test-examples