Fix bug in put before/after