fixed bit shifting bug