Fix an "off by one dt" bug: The is_active variable should be updated
*before* a state update, not after.
Merge branch 'master' into devices