Fix #3 and some other issues