fix bug in source_free