utilities for both server and client