fixing #95 by adding additional check