Fixed the return code upon program errors