Fixed some runtime errors.