ajax handling fixes and modifications