fixed init function