Fix some problems with reading in function definitions