Change the parent class for smallmatrix to ensure correct parsing. Smallmatrix needs to be a decendent of an Array type because it uses similar syntax.
Ensure that all 'Array' type environments are in math mode if one of their ancestors are. This is needed to prevent the addition of extra line breaks which break equation rendering in pdfLaTeX. Further work needs to be done to see if it ever makes sense to add those extra line breaks.