Added color threshold to judge whether fitting was alright