fixed compiler warning
added extra check for item existance in unit test