Fixes issues in pull request 532