is the error ocuring before this function call?
if not then is must be one of your parameters