Error checking and fixes.

Maybe we can make an organisation, or you could make me mantainer. If you agree, of course. But then I don't have to send PRs every day. :P