Simplify the commands and fix a small bug