Fix #9 (multiple optimal solutions).
Fix some signed/unsigned warnings.