Fix custom middleware macro