Fix top level issue, add more tests