added checking if empty