Fixed a bug in try_next_action