If it appear by such certificate or reference, in case the certificate is not produced, that any such liens exist, the court shall appoint a referee to ascertain what amount remains due thereon or secured thereby respectively, and the order of priority in which they are entitled to be paid out of the property.