fixed and tested function on penalties