fix critical errors with cursor and diagram