your problem is quite simply that you're sending the mode command BEFORE you've sent the corresponding join command (dunno how this could possibly be construed as a mirc bug laugh!), i.e:

Code:
join #chan | mode #chan -o $me


is ok (providing #chan is empty, and unregistered, before you join it) but:

Code:
mode #chan -o $me | join #chan


is obviously invalid. what i recommend you do is build a list of mode commands, $+(mode #chan1 -o $me,$crlf,mode #chan2 -o $me,$crlf,...) where $crlf is used to send multiple commands to the server in the same packet

then you can send the join command at the end, and the mode if applicable


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde