Ban fixes

Ban needs quite a bit of testing.
TBH I'm not sure I ported **all** the fixes, I may have missed something.

The PR includes also the fix for:
http://www.simplemachines.org/community/index.php?topic=506463.0