Added error check for calloc