Fix some cursor positioning issues.