Fixed the picture cpount logic