reset state flag in service works
Daniel found the double-to-int error