core: do not manipulate bits directly