Fixing bug with accessing objects