Bug Fix from aqtoolkit

Merged newest changes from aqtoolkit which fixes a bug with key lengths.