Fix complex

This branch fixes the issues with encoding complex numbers using JSON.