Added logic to unload stateful kernel modules