Fixed exception when a view is not attached to a file