more fixing of bit arithmetic errors