Fixed bug in f