After working for days I finally found the root that causes a lot of errors in illegal access to memory in my programs and it is my recent edit.
Here is the old versi