fixed bug.
Adding support for version 6