the general inverse is not quite correct. check to get integer matrix.