bugfix: writing to directory in stead of fileé