fix warnings and clean up