Several fixes to tuple module.
Unit tests for tuple module.