fixes context bug withing ajax function