From what I see at quick glance, your code snippet above indeed can only open ASSET_C or B. So the problem is somewhere in the rest of the code.