relay: cleanup and fix build