fixed hacky code