fixed nullpointerexceptions for empty objects