fixes #120: speed optimizations for REST