As of this posting, I have updated 4.0.15 build 002 with fixes for the GALLERY tag / lazy-loader conflict. You may need to clear your wiki cache in order for the changes to take effect: Wiki Admin Panel > Maintenance > Rebuild Counters / Caches > Cache Parsed Content.
Build 002 also includes fixes for the other errors you attached here.
This issue is now marked as fixed. If you encounter a new problem, please start a new bug report.