Fixed looping problem for sunlight api call