Improve port. Fix ajax bug.