fix variable names clash
migrate code to latest cowboy