fix crashing on duplicate insert
edit changed _lastSync structure
fix failing test