Fix and test supervisor hook creation and removal functions