rebuild and fix logic and status bug