fixed a bug, type assertion on nil pointer