improved ruby dialect, removed a divide by zero bug and spotted a mysql syntax error

some contribution to the code base, more to come :)