Fix script matching in middleware. Closes #18