added null check for jsgl