Bug Fix

Fixed Wait command and related bugs