fixed a problem with preffix and postfix length calculation