changed function prototype to use this function to indicate an error to user