use delete() instead of free() for objects