Bugfix: add cast to integer before creating range.