Fixed errors and deprecation warnings.