sets m,n to 0 if error occurs