Safer lua scripts loading, and other

- check date value to be not falsy before typecasting
- settings.ignoreNullValues should not affect undefined values
Postpone updating for aggregates and caching