a small fix to prefix calculation