Fix some deprecation and unchecked warnings