remove tailing slash
fix regexp
remove debug lines