Mex locking init to prevent crash on clear all