bugfix: incorrect pointer was checked on device function lookup

It was reported by Kondo Taiki, during investigation of bug #5