fix "too much recursion" calendar javascript error