fixed implementation errors in respect to previus code review