change file mode

some bug fixes