Fixed some shell bugs