work with filename only if non-empty