adjust filename creation to avoid os seperators + empty filenames. Fixes #11 and #12