Fixed errors in commands hook