Rewrite copyAssets and better error handling