fixed some hacky code