Added new example custom_backend.py and fixed a bug in Backend.