corner cases fixed