Fixes based on PMD analysis