Made the code more robust and detect nkPrefix as number (-1 or +4) for enum sorting. Added also a new test for enums.