Fix insert_resource