Fixing nightmarish problem with serialize. Fix #1189