Fix some bugs

Auto-detect Sport (if there's an empty lesson Wednesday or Thursday P
4/5).
Fix some bugs which would cause the browser to hang

Stupid blocking while loops.