Bug fixes and save to file

Fixed the problem with the wrong colors.