Added sample pixel check