Fixed a bug which introduced infinite loops in the surface water model and improved its stream segment direction finding algorithm.