Bug fix in get average brightness
Bug fix in get average brightness
removed some duplicate checks