Fixing engine factory to return the underlying engine properly.

There was a bug with the `engine.engine` property being `null` and not getting set properly. This fix makes sure the correct `engine` property is returned.