Cannot use object of type stdClass as array