Bug fixes in scaler code.