standardize return code and set exit code

Change-Id: Ia0648d4490af91cffc132131a8d04b6384243579