Fix codec and wsgi code