katriawm: fix cross compilation and minor improvement
authored by Nick Cao and committed by Anderson Torres 2 years ago ef8d674c 8ad2a44a