fixes for ajax function