Bugfix and refactoring

Bugfixes in uvutil and visualutil.  Refactoring in uvmodel.