corrected a bug
improved pi