fixed problem with help from Jerf