Optimized memory management

1. Inefficient/Incorrect implementation of value_exists() fixed
2. Call to gc() in load_core_library() removed