Fix some style and code