some optimisations and fixes a few cursor timeouts