fixed some  memory leaks
fixed unnecessary virtual commands