Fixed black threshold being ignored sometimes. Fixed saving the wrong average color as previous color.