Bug fixes on server and client