#12 added fix to handle the error case where there is no closing ]