fixed runtime errors