fixed seg fault where double was in place of a pointer