bugfix - added additional check