The values in Memory.current and Memory.previous are updated via Memory.update() and Memory.update_previous(), which are called at weird times. It is difficult to tell what exactly to expect what game state information those values will hold in the different mupen callbacks like atvi, atinput or atdrawd2d.
To combat this, the points in time that the game state that are supposed to be held by Memory.current and Memory.previous respectively should be well specified, and any offending code should be adjusted accordingly.