fix cursor positioning