Revert "return 0 instead of NULL"

This reverts commit 4fc67e03d76586fc8c11277bdb4e355a9a6f5c26.