fix bug in ajax handler