fixed some bugs with server/client behavior