Fixes to scaler function