fixed reverse string to work with c-style strings