Fixed several memory leaks with dynamic assets loading