take into account that realpath may not be available