fix warnings and cleanup