api functions javascript fixes