implemented site stat, fixed a couple of quirks with handling final newline in templates