Fixed runtime errors