change bitwise where necessary