fixed error where tempHistory was trying to update with light, and added counter to stop ajax calls