BUG: infinite loop in vector/matrix conversions