ensure iterate is defined
ensure iterate is a function
fix getLocalTime