Many bugfixes
Merge pull request #4 from Novatux/master

Many bugfixes