build fix.. need to make this RAII