Adding some tests and fixing some code because of them, adding travis