Additional test cases and small fixes