fixed render_file so that errors result in correct debugging output