ERROR: Bad or undefined variable "pid"