Fix bug in `setView`

Only remove the previously-existing view if it differs from the new
view. This prevents the removal of deeply-nested views.
Merge pull request #435 from jugglinmike/fix-remove-view

Fix bug in `setView`