Fix frame->matrix conversion