Implement webhook
Fix some bugs in the webhook