restored 'wrong order' of setting sample rate

Also use the existing functions.