handle arbitrary paths and improve tests