Fix bug regarding result in output