fixes #1387, better handling of ajax handler var