Fixing throwing exceptions without a memory frame, fixing possible memory leaks in config
Restoring changes in merge