Fixed error in code

On local enviroments the code throws error, because the global BASE_URI
is not available. Build in a safeguard to handle this.