fixed bug with length management states