checks that input doesn't try to devide by 0

Fixes #4