Adding complex (sp and dp) plus a bug fix