Small fix to tidy code and unsubscribe from preference change