fixed bugs
fixed a divide by zero bug