Fix console error "this.getPref is not a function"

Fix console error "TypeError: this.getPref is not a function" on line 122.

I don't know how to test it, but are you sure the "this." on line 124 is working?

I'm not sure if it would be better this "if" block being in another place...

Thanks.