Refactor and add a check around a variable

Changed serializer to self._serializer, to be able to access it
from other places in the engine class. Added a check to make sure
it doesn't get created twice.

Change-Id: Ia4007a5f98af04677b2006a88b66cbf8ceec2982
Merge "Refactor and add a check around a variable"