Fixed some security bugs and #priv command