fixes #1: fix pending logic;