Calculating message length based on bytes