fixed embedding demo and error handling in embed.js