Minor bug in some internal logic