Fix ugly bug in 3.js

Signed-off-by: Thameera Senanayaka <thameera123@gmail.com>