Fixed the viewer connection behaviour so it is exactly like the viewer
node does in nuke.
Also fixed a potential overflow in ViewerInstance
Bug fixes in undo/redo when connecting/disconnecting a viewer