Fixed inactivity timeout and bugs