Cleaner detection of bindings with better error handling.