[REBUILD/UPGRADE REQUIRED] Fix Remove Locks functionality

Revised fix for Remove Locks functionality to address issue with tree refreshing.