fix runtime errors