Removed unnecessary matrix check