Scene engine connection

fixing some bugs handling null scene in the engine connection.