Fixing internal server err on hook