Fixed javascript error's when missing data