query string improvement
add check file exists to prevent error.