bugfix calculating correct limits