fixing dirpath function - fixes #30