fix bugs reported by Michela Brunelli on masking of some data