rewrite: misc bug fixes
rewrite: fix user avatar stats
rewerite: refresh when logging in