Starting process with higher priority

So I’ve created a script which starts

sudo setPrio.sh ~kriko/bin/playonlinux-bin/playonlinux -15;

This works, but not if I try to start the same thing under another xorg instance.

Sound fails to start and so does all games.

for e.g.:
xinit playonlinux.sh – :1

will call:

sudo setPrio.sh ~kriko/bin/playonlinux-bin/playonlinux -15;

and setPrio.sh is:

#! /bin/bash

APP="$1"
PRIO="$2"
PARAMS="$3"
PID=0

if  $2 ] ; then
  echo "ok, priority set to $2";
else
  PRIO=0
  echo "priority set to 0";
fi

function run {
#  xhost +localhost
  powersave -f
  powersave -c
  nvidia-settings --assign="SyncToVBlank=1"
  echo $APP
#  exit 1
#  nice -n $PRIO sudo -u kriko $APP "$PARAMS" -- :1 &
  nice -n $PRIO sudo -u kriko $APP "$PARAMS" &
  PID=$!
  sleep 5
}

function loopCheck {
echo $PID
  search=$(ps --pid $PID -o comm=)

  if  $search ] ; then
#    renice $PRIO $PID;
    sleep 15;
    loopCheck;
  else
    getOut;
  fi
}

function getOut {
  nvidia-settings --assign="SyncToVBlank=0"
#  powersave -A
#  xhost +
#  xhost +localhost
  exit 0
}

run;
loopCheck;
getOut;

and I’m not able to figure out why. same thing works if started under xorg :0 instance but not under :1 :S