clean up misc stuffs and add frandom
fix this up it caused panic