added check for 0 by 0 error