fix warning and a bug