Fix strict narrowing violations by static casting