fix for replace callback issue reported by alex