fixed bug with mysql connection encoding
fixed possible bug with server hangs on map change
some codestyle fixes
yet another codestyle fixes
tabs replaced with spaces