some ugly optimize