bug fixes and matrix support