sync new code + fix gallery