fixed two edge cases for previous commit