fix truncating common prefix for generated names (Closes #7)