fixed a bug with msb buffer offset calculation