better valueOf checking