Fixing potential bug in initialization