added reason detection for reject