Looks like I was able to solve this by doing it slightly differently...

Quote
key_forward = file_var_read(key_filehandle);
str_for_key(str_forward,key_forward);


It was strange, and I can't explain why I was getting other errors, but by saving the key as a variable instead of a string, it seems to fix all the problems.