fix bug where configured prefixes can be undefined
fix test mock and remove unused variables
execute tunnel middleware as an async queue