bug in conditional check