Fix two small bugs and improve doc for get_constant_idx().