Bug fix on free