JS backend: improve checks and constructor retrieval