added automatic path detection