generate code that works differently for fat client and jsclient
related to #8