Function join_bytes should do a shift left instead of shift right.