Change terminate/2 to terminate/3 for cowboy