set bitmask and add extra test output for debugging purpose