fixed calculateBound method