Fixed bugs that completely broke the extension :(

My amateur javascript skills + zero testing...