Simplified the code and get full remote path now

Potencial issue may occur because I don't really understand all codes...it just work right now and I will keep monitor the issue and try to fix if I found.