paste-and-pop: add guards

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>