Remove workaround for time calculation and improve error handling