Get the correct path if called statically. Fixes #1738