The thing about the join even though is that it is before you are given op status so you can't really check if you are op or not. When I join a room I have a 2 or 3 second timer that triggers an alias "op_check" which is where I store different commands I may want to implement if I am joining a channel as op.

Also, there is no need to double check a mode before making a mode change. There will be no error.