better cursor handling
added constraint to not resize with length<1