fix mongo connection leak & ajax issue