Fix in <key,value> usage in middleware variable parsing

Previous case was reading as [value, key].
Fix for index being treated as string and causing extracted 'id' variable to be undefined