bug fixes on the single document lookup