Fixed #20234 and #20236 -- SingleObjectMixin fixes

Added object on SingleObjectMixin returned context,
some code clanup.
Merge pull request #1116 from elektrrrus/ticket_20234_20236

Ticket 20234 20236