Added debugging to stderr, fixed working directory and removed a lot of notices