fix crash bug and texture issue when using editor.