safely add and remove markers