isCurrent function
Fix two refactor bugs