This might fix the pointer problem (needs testing).