Doubled length value and added check if both values are the same which i...

...s unlikely to happen for wrong or broken packages

Probably fixes #2705