Fix ZeroDivisionError

Signed-off-by: Kirill Kondratenko <cybem@cybem.info>