Move error printing to top of source