fix exists and add import declarations