Fixed undefined xhr bug