add isset() checks to prevent php errors