fixed free and modified calloc
fixed free and modified calloc