fixed issues with finding the err matrix size