added count and delete, fixed a bug in requeue when given an invalid state