dirty hack to allow use both client and server