replace: check for dirname() and basename()