On the determination of the gluon density of the proton from heavy-flavour production at HERA