Fixed hook logic that crashed server