Probably the easiest thing to do is to step through the code to see where it blows up and then examine the contents of your memvars. You will probably spot the invalid file name immediately and be able to correct your code accordingly.