Fixed npe's when serializing entities. Closes #40 .