Unit tests for sequence and bug fixes