added fix to handle invalid filename-input