worked out a bug