fixed bug in the bind function