You cant gsub when layout is nil.