check if gPad is valid first