Fixed policy replacement

Jira-issue: WP-709
Added tests on policy replacement

Jira-issue: WP-709