fixed error 500 in OPM reports
small refactoring
code refactored
code refactored
code refactored
Merge pull request #3189 from lwyszomi/opm_500_error

Opm 500 error