Minor bug fix to isleaf call