modified degenerate cases to return 0