fixed handling of empty files (fixes #49)
better handling for empty files (see #49)