"get_val": some bug fixes