make it work with pathname objects