better error messages when middleware args are passed incorrectly