adjustments to cursor handling
various bugfixes