Fixed lua error that prevented successful calculations