Fix warnings and deprecated usage