Finally fixed error with help from a friend