Fix test_mode assignment bug

Fixes issue #3