Fixes #3

The problem was solved by adding timeout for the chosen function