Fixed bug found while reading code

Now it should work