Added better initialization checks