Fixed casting warnings. Added condition to only log if running on simula...

...tor or debug build.