H had not been initialized so it was causing problems