FS-5819: fix bounds check on enum type