fixed error and output