fixed issue with fg.weights.size check by using dense vectors for the code generated by the spec.