fixing edge case. adding tests