fix handling ajax response