Write errors to stderr

And import the sys module