changed compare to return null/err