Fix calc and calcAll to fully work with json loader, and unit tests.