added safe check for color