Fixed null to object and object to null conversion bug and implemented c...

...orresponding tests