Fixes multiple leaves bug