Small bug fixes, ready for travis integration, examples and readme in next commit