errors in inv calculation