Fixing penalty calculation