Fixed #216, added several tests for ajax module and fixed more stuff revealed by...