fixed a bug in deref