add HELO command, fix bug in middleware registration