Bug fixed. Explanation in docstring.