#119: fix integer cycling and add test