division by zero causing error in bilateral