fix regex to match only valid params depending on the given mode
let fileresponseclass handle not found errors