fix realpath exception handling if realpath doesn't exist