This is a frequent problem - there are many threads about this on the forum. Compare the folders systematically until you found what's missing or different between your two versions. Also, make your code more bug proof by doing a nonzero test with all pointers that you're using. If it happens with SCAN_TEXTURE at a certain place, it should be not too hard to find.