correct calculation of messageSize > 255