Use 'output' macro, not stderr directly
Fix realpath usage