added freeCommandPtr