Essays on bank loan contracts