updated logic to work correctly
Signed-off-by: Alex Lourie <djay.il@gmail.com>