Fixing error with no initialised object