Fixes some problems related to delete departments with members