updated pyval, fixed newlines in file mode