fixed p_files bug and wrote basic do_open