fixed seg-fault