fixing jsonification to use flask properly