renamed lastchar -> active_char, seems to work now