Oh. I think you mean to pass mode to the function below.  Notice that you don't need isPicture. Can't you just query the mode setting value instead of testing whether its value is picture or not?