arm: fix some bugs reported by VS2010. thanks Axel for testing