Fixed missed type->category variables.

Added checks for black values.