Added custom realpath method.