Is it possible to automatically reassign VNC ports when ports are already assigned

Used onedb fsck with a modified fsck script (see other discussion on this forum) here.
This fixed long time pending machines because of this error. But today two machines were started after being shutdown for a few days, and they run into this problem, both wanting to use the same VNC port. Very annoying.