fixed a silly mistake with counting bits