some preprocessing