Bug/interface error add lock

This seems to close:
InterfaceError: Error binding parameter 0 - probably unsupported type. (Bug #5139)