Added checks for null closure
Fixed bug in past calculation