Fixed calculation of serialNumber (do not use bitwise operators due to 32-bit signed limitation)