fix oncommand, remove unused variable