maybe add some debug logging here in case 0 is returned?