Fixed undefined method `captures' for nil:NilClass (NoMethodError)