refactor Compile function, and finally fixed a long standing bug

it was impossible to use 2 variables in a url, if one was at the end of url