Cost func fixed. Test passed.