FIX: assert now lives inside lock. Thread-safety