Bug-fixed. Sometimes robot_getCardId() was returning -1.
Added new modifications.