fixed rest of NP problem