fix misuse of memset (thanks dcb314)