Added a change for checking 0 sized matrix.. exit if size is 0