client: memory optimization; server: bug fix