Fixing infinite loop bug https://github.com/xolvio/rtd/issues/167