NPE in '/crate open'

Fixed some NPEs in '/crate open' and its related commands.