Changed nil comparison ftom type(c) == "nil" to c == nil.