Actual cost fix to avoid nil comparison with date
Merge with Joao changes