fixed capacity calculation and made code more robust
Authored by: grether 2010-02-19
Parent: [r10509]
Child: [r10511]